package com.xmu.prcs.entity;

import java.io.Serializable;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;

/**
 * 用户-角色表
 * @author frequent
 * @version 1.0,2012-3-20
 *
 */
@SuppressWarnings("serial")
@Entity
@Table(name = "userrole")
public class UserRole implements Serializable{

	private Integer idUserRole;
	private Role role; //角色
	
	public UserRole(){
		
	}
	
	@Id
	@GeneratedValue
	@Column(name = "iduserrole", unique = true, nullable = true)
	public Integer getIdUserRole() {
		return idUserRole;
	}
	public void setIdUserRole(Integer idUserRole) {
		this.idUserRole = idUserRole;
	}
	
	@OneToOne(optional = true,  fetch = FetchType.LAZY)
	@JoinColumn(name = "idrole")
	public Role getRole() {
		return role;
	}
	public void setRole(Role role) {
		this.role = role;
	}
	
	
}
